home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / tools / czesc_1 / autopass / autopass.c < prev    next >
C/C++ Source or Header  |  1993-03-29  |  2KB  |  69 lines

  1. /******************************************************************
  2.  *
  3.  * Project : AutoPass.c
  4.  *
  5.  * Syntax  : AutoPass <UserID> <Passwd>
  6.  *
  7.  * Short   : Automatic login for MultiUserFileSystem
  8.  *
  9.  * Author  : Bjorn Reese (breese@imada.ou.dk)
  10.  * Date    : 02.04.94
  11.  *
  12.  * Compile : (SAS/C 6.3) sc LINK AutoPass.c
  13.  *           Remember the MultiUser includes
  14.  *
  15.  * This program is Public Domain. No warrenties whatever are given.
  16.  *
  17.  ******************************************************************/
  18.  
  19. #include <stdio.h>
  20. #include <proto/exec.h>
  21. #include <dos/dos.h>
  22. #include <utility/tagitem.h>
  23. #include <clib/multiuser_protos.h>
  24. #include <libraries/multiuser.h>
  25. #include <proto/multiuser.h>
  26.  
  27.  
  28. char const *version = "$VER: AutoPass V1.0 by Bjørn Reese (02.04.94)";
  29.  
  30. int CXBRK(void) {return(0);}
  31. int chkabort(void) {return(0);}
  32.  
  33. void main(int argc, char *argv[]) {
  34.  
  35.     struct muBase *muBase;
  36.  
  37.     struct TagItem muTags[] = {
  38.         muT_UserID, NULL,
  39.         muT_Password, NULL,
  40.         muT_Graphical, FALSE,
  41.         muT_Global, TRUE,
  42.         TAG_DONE
  43.     };
  44.  
  45.  
  46.     if (argc == 3) {
  47.         if (muBase = (struct muBase *)OpenLibrary(MULTIUSERNAME, MULTIUSERVERSION)) {
  48.  
  49.             muTags[0].ti_Data = (ULONG)argv[1];
  50.             muTags[1].ti_Data = (ULONG)argv[2];
  51.             if (!muLoginA(muTags))
  52.                 printf("Error: Invalid UserID or Password\n");
  53.  
  54.             CloseLibrary((struct Library *) muBase);
  55.  
  56.         } else {
  57.  
  58.             printf("Error: Can't open multiuser.library\n");
  59.  
  60.         }
  61.  
  62.     } else {
  63.  
  64.         printf ("AutoPass V1.0 by Bjørn Reese\nSyntax: AutoPass <UserID> <Password>\n");
  65.  
  66.     }
  67.  
  68. } /* main */
  69.